package com.elong.businesstravel.protocol.login;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONObject;

import com.elong.businesstravel.entitys.MessageNotice;
import com.elong.businesstravel.protocol.baseresponse.BaseELongJsonHttpResponse;

public class MemberGetNoticeResponse extends BaseELongJsonHttpResponse {

	public List<MessageNotice> messageNotices = new ArrayList<MessageNotice>();
	
	@Override
	public void onSuccess(int statusCode, Header[] headers,
			JSONObject mainJsonObject) throws Throwable {
		JSONObject responseJsonObject = mainJsonObject.optJSONObject("response");
		JSONArray noticeJsonArray = responseJsonObject.optJSONArray("notice");
		for (int i = 0; i < noticeJsonArray.length(); i++) {
			JSONObject itemJsonObject = noticeJsonArray.optJSONObject(i);
			MessageNotice messageNotice = new MessageNotice();
			messageNotice.msg = itemJsonObject.optString("msg", "");
			messageNotice.addtime = itemJsonObject.optString("addtime", "");
			messageNotice.msgtype = itemJsonObject.optString("msgtype", "");
			messageNotices.add(messageNotice);
		}
	}

}
